<div class='accordion'>
	<h3><a href="#">Contenus</a></h3>
	<div id='contenus_main'>
		<div id='contenus_liste' class='ui-corner-all ui-widget-content' style='padding-top: 5px; padding-bottom: 5px;'>
			<table id='contenusliste' cellspacing='0' cellpadding='1' style='width: 100%; border-top: 1px solid #000000;'>
				<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."barres_laterales_contenu order by nom");
				$i=0;
				foreach($res as $var){ ?>
				<tr>
					<td id='C<? echo $var->id; ?>' class='ui-state-default' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' style='width: 10px; padding-left: 2px; border-width: 0px; border-bottom: 1px solid #000000; border-right: 1px solid #AAAAAA; cursor: pointer;'  <? if($var->type!=1){ ?>onclick="$('#dialog').attr('idContenu',$(this).attr('id')); open_dialog('Supprimer un contenu', 'Etes-vous sur de vouloir supprimer ce contenu?', { 'Non': function() { $(this).dialog('close'); }, 'Oui': function() { document.getElementById('formContenusSupprimerContenu'+$(this).attr('idContenu')).submit(); $(this).dialog('close'); open_loading(); } });"<? } ?>>
						 <? if($var->type!=1){ ?>
						 <span class="ui-icon ui-icon-circle-close tooltip" title='Supprimer ce contenu'></span>
						<form name='formContenusSupprimerContenuC<? echo $var->id; ?>' id='formContenusSupprimerContenuC<? echo $var->id; ?>' action='admin?confmodule=barres_laterales' method='post'>
							<input type='hidden' name='id' value='<? echo $var->id; ?>' />
							<input type='hidden' name='action' value='supprimer_contenu' />
						</form>
						<? }else echo "&nbsp;"; ?>
					</td>
					<td class='ui-state-default' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' style='padding-left: 5px; cursor: pointer; border-width: 0px 0px 1px 0px;' onclick="window.open('admin?confmodule=barres_laterales&editContenu=<? echo $var->id; ?>','_self');"><? echo $var->nom; ?></td>
				</tr>
				<? $i++; } ?>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick="window.open('admin?confmodule=barres_laterales','_self');" class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-circle-plus"></span>Nouveau contenu</a></div>
			<br />
		</div>
		<? if(isset($_REQUEST["editContenu"])){
			$var=$sql->request_single("select * from ".CFG_MYSQL_PREFIX."barres_laterales_contenu where id=".$_REQUEST["editContenu"]);
			$contenu=new barres_laterales_contenu($var); ?>
		<div class='ui-widget-header ui-corner-all title2'>Modifier un contenu</div>
		<div id='contenu_content' class='ui-corner-all ui-widget-content'>
			<form name='formAdminEditContenu' method='post' action=''>
				<table style='width: 100%;'>
					<tr class='tr1'>
						<td>Nom : </td>
						<td><input type='text' name='nom' value='<? echo $contenu->nom; ?>' /></td>
					</tr>
					<tr class='tr2'>
						<td>Type : </td>
						<td>
							<select <? if($contenu->type==1) echo "disabled='disabled'"; ?> name='type' onchange='contenu_changeType(this.options[this.selectedIndex].value);'>
								<option value='2' <? if($contenu->type==2) echo "selected='selected'"; ?>>Texte</option>
								<? if($contenu->type==1){ ?><option value='1'  selected='selected'>Module</option><? } ?>
								<option value='3' <? if($contenu->type==3) echo "selected='selected'"; ?>>Code PHP</option>
							</select>
						</td>
					</tr>
					<tr id='trModule'  <? if($contenu->type!=1) echo "style='display: none;'"; ?> class='tr1'>
						<td>Module : </td>
						<td>
							<select name='module' <? if($contenu->type==1) echo "disabled='disabled'"; ?>>
								<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."module where actif=1 and parentModule regexp '(^|.*,)barres_laterales(,.*|$)'");
								foreach($res as $var){ ?>
								<option value='<? echo $var->nom; ?>'><? echo $var->nomComplet; ?></option>
								<? } ?>
							</select>
						</td>
					</tr>
					<tr id='trCode' <? if($contenu->type!=3) echo "style='display: none;'"; ?> class='tr1'>
						<td style='vertical-align: top;'>Code PHP : </td>
						<td><textarea name="codePHP" id="codePHP"><? echo $contenu->texte; ?></textarea></td>
					</tr>
					<tr id='trTexte' class='tr1' <? if($contenu->type!=2) echo "style='display: none;'"; ?>>
						<td style='vertical-align: top;'>Texte : </td>
						<td><textarea name="texte" id="texte"><? echo $contenu->texte; ?></textarea></td>
					</tr>
				</table>
				<br />
				<div class='align-center'><a href="#" onclick="open_loading();  document.formAdminEditContenu.submit();" class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Modifier</a></div>
				<br />
				<input type="hidden" name='id' value='<? echo $contenu->id; ?>' />
				<input type="hidden" name='action' value='editer_contenu' />
			</form>
		</div>
		<? }else{ ?>
		<div class='ui-widget-header ui-corner-all title2'>Ajouter un contenu</div>
		<div id='contenu_content' class='ui-corner-all ui-widget-content'>
			<form name='formAdminAddContenu' method='post' action=''>
				<table style='width: 100%;'>
					<tr class='tr1'>
						<td>Nom : </td>
						<td><input type='text' name='nom' /></td>
					</tr>
					<tr class='tr2'>
						<td>Type : </td>
						<td>
							<select name='type' onchange='contenu_changeType(this.options[this.selectedIndex].value);'>
								<option value='2'>Texte</option>
								<option value='3'>Code PHP</option>
							</select>
						</td>
					</tr>
					<tr id='trCode' style='display: none;' class='tr1'>
						<td style='vertical-align: top;'>Code PHP : </td>
						<td><textarea name="codePHP" id="codePHP"></textarea></td>
					</tr>
					<tr id='trTexte' class='tr1'>
						<td style='vertical-align: top;'>Texte : </td>
						<td><textarea name="texte" id="texte"></textarea></td>
					</tr>
				</table>
				<br />
				<div class='align-center'><a href="#" onclick="open_loading();  document.formAdminAddContenu.submit();" class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-circle-plus"></span>Ajouter</a></div>
				<br />
				<input type="hidden" name='action' value='ajouter_contenu' />
			</form>
		</div>
		<? } ?>
	</div>
	<h3><a href="#">Barre gauche</a></h3>
	<div>
		<form name='formAdminBarresLateralesGauche' action='' method='post'>
			<table style='width: 100%;' cellspacing='0' cellpadding='2' class='ui-corner-all ui-widget-content'>
				<tr class='tr1'>
					<td style='width: 250px;'>Active sur le portail</td>
					<td>
						<input type='hidden' name='cfg_barre_gauche_active_portail' value='0' />
						<input type='checkbox' name='cfg_barre_gauche_active_portail' value='1' <? if($cfg_params["barre_gauche_active_portail"]) echo "checked='checked'"; ?> />
					</td>
				</tr>
				<tr class='tr2'>
					<td>Active sur le reste du site</td>
					<td>
						<input type='hidden' name='cfg_barre_gauche_active_site' value='0' />
						<input type='checkbox' name='cfg_barre_gauche_active_site' value='1' <? if($cfg_params["barre_gauche_active_site"]) echo "checked='checked'"; ?> />
					</td>
				</tr>
				<tr class='tr1'>
					<td>Largeur en pixels</td>
					<td>
						<input type='text' name='cfg_barre_gauche_largeur' value='<? echo $cfg_params["barre_gauche_largeur"]; ?>' />
					</td>
				</tr>
				<tr class='tr2'>
					<td style='vertical-align: top;'>Contenu</td>
					<td>
						<div class='contenusSortable' id='gauche'>
						<? foreach($cfg_params["barre_gauche_contenu"] as $id){
							if($id!=""){
								$var=$sql->request_single("select * from ".CFG_MYSQL_PREFIX."barres_laterales_contenu where id=".$id);
								if($var!==false){ ?>
							<div class='contenusSortableItem' id='<? echo $var->id; ?>'>
								<table cellspacing='0' cellpadding='0'>
									<tr>
										<td>
											<span class='ui-icon ui-icon-arrowthick-2-n-s' style='float: left;'></span>&nbsp;<? echo $var->nom; ?>
										</td>
										<td style='width: 10px; border-width: 0px; border-left: 1px solid #000000;' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' onclick="contenu_removeContenu('gauche',this);">
											<span class="ui-icon ui-icon-circle-close tooltip" title='Supprimer ce contenu'></span>
										</td>
									</tr>
								</table>
							</div>
								<? }
							}
						} ?>
						</div>
						<input type='hidden' name='cfg_barre_gauche_contenu' id='cfg_barre_gauche_contenu' value='<? echo implode(",",$cfg_params["barre_gauche_contenu"]); ?>' />
						<table>
							<tr>
								<td>
									<select id='contenusSelect_gauche'>
										<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."barres_laterales_contenu");
										foreach($res as $var){ ?>
										<option value='<? echo $var->id; ?>'><? echo $var->nom; ?></option>
										<? } ?>
									</select>
								</td>
								<td><div class='div-icon ui-state-default ui-corner-all pointer tooltip' title='Ajouter ce contenu' onclick="contenu_addContenu('gauche');"><span class="ui-icon ui-icon-circle-plus"></span></div></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick='document.formAdminBarresLateralesGauche.submit();' class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Enregistrer</a></div>
			<br />
			<input type='hidden' name='action' value='enregistrer_configuration' />
		</form>
	</div>
	<h3><a href="#">Barre droite</a></h3>
	<div>
		<form name='formAdminBarresLateralesDroite' action='' method='post'>
			<table style='width: 100%;' cellspacing='0' cellpadding='2' class='ui-corner-all ui-widget-content'>
				<tr class='tr1'>
					<td style='width: 250px;'>Active sur le portail</td>
					<td>
						<input type='hidden' name='cfg_barre_droite_active_portail' value='0' />
						<input type='checkbox' name='cfg_barre_droite_active_portail' value='1' <? if($cfg_params["barre_droite_active_portail"]) echo "checked='checked'"; ?> />
					</td>
				</tr>
				<tr class='tr2'>
					<td>Active sur le reste du site</td>
					<td>
						<input type='hidden' name='cfg_barre_droite_active_site' value='0' />
						<input type='checkbox' name='cfg_barre_droite_active_site' value='1' <? if($cfg_params["barre_droite_active_site"]) echo "checked='checked'"; ?> />
					</td>
				</tr>
				<tr class='tr1'>
					<td>Largeur en pixels</td>
					<td>
						<input type='text' name='cfg_barre_droite_largeur' value='<? echo $cfg_params["barre_droite_largeur"]; ?>' />
					</td>
				</tr>
				<tr class='tr2'>
					<td style='vertical-align: top;'>Contenu</td>
					<td>
						<div class='contenusSortable' id='droite'>
						<? foreach($cfg_params["barre_droite_contenu"] as $id){
							if($id!=""){
								$var=$sql->request_single("select * from ".CFG_MYSQL_PREFIX."barres_laterales_contenu where id=".$id);
								if($var!==false){ ?>
							<div class='contenusSortableItem' id='<? echo $var->id; ?>'>
								<table cellspacing='0' cellpadding='0'>
									<tr>
										<td>
											<span class='ui-icon ui-icon-arrowthick-2-n-s' style='float: left;'></span>&nbsp;<? echo $var->nom; ?>
										</td>
										<td style='width: 10px; border-width: 0px; border-left: 1px solid #000000;' onmouseover='$(this).addClass("ui-state-hover");' onmouseout='$(this).removeClass("ui-state-hover");' onclick="contenu_removeContenu('droite',this);">
											<span class="ui-icon ui-icon-circle-close tooltip" title='Supprimer ce contenu'></span>
										</td>
									</tr>
								</table>
							</div>
								<? }
							}
						} ?>
						</div>
						<input type='hidden' name='cfg_barre_droite_contenu' id='cfg_barre_droite_contenu' value='<? echo implode(",",$cfg_params["barre_droite_contenu"]); ?>' />
						<table>
							<tr>
								<td>
									<select id='contenusSelect_droite'>
										<? $res=$sql->request("select * from ".CFG_MYSQL_PREFIX."barres_laterales_contenu");
										foreach($res as $var){ ?>
										<option value='<? echo $var->id; ?>'><? echo $var->nom; ?></option>
										<? } ?>
									</select>
								</td>
								<td><div class='div-icon ui-state-default ui-corner-all pointer tooltip' title='Ajouter ce contenu' onclick="contenu_addContenu('droite');"><span class="ui-icon ui-icon-circle-plus"></span></div></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<br />
			<div class='align-center'><a href="#" onclick='document.formAdminBarresLateralesDroite.submit();' class="a-button ui-state-default ui-corner-all"><span class="ui-icon ui-icon-disk"></span>Enregistrer</a></div>
			<br />
			<input type='hidden' name='action' value='enregistrer_configuration' />
		</table>
	</div>
</div>
